package Game;


public class RockPaperScissors {
	
	Result play(RPSEnum p1, RPSEnum p2)
	{
		Result r = Result.LOST;
		switch(p1)
		{
			case PAPER:
				switch(p2)
				{
					case PAPER:
						r = Result.TIE;
						break;
					case ROCK:
						r = Result.WIN;
						break;
					case SCISSORS:
						r = Result.LOST;
						break;
				}
				break;
			
			case ROCK:
				switch(p2)
				{
					case PAPER:
						r = Result.LOST;
						break;
					case ROCK:
						r = Result.TIE;
						break;
					case SCISSORS:
						r = Result.WIN;
						break;
				}
				break;
				
			case SCISSORS:
				switch(p2)
				{
					case PAPER:
						r = Result.WIN;
						break;
					case ROCK:
						r = Result.LOST;
						break;
					case SCISSORS:
						r = Result.TIE;
						break;
				}
				break;
		}
		
		return r;
	}

}
